package com.eshipenet.shipnet.edgeboxextbuilder
import org.apache.flink.streaming.api.windowing.triggers.{Trigger, TriggerResult}
import org.apache.flink.streaming.api.windowing.windows.{GlobalWindow, Window}

class EdgeBoxActionTrigger extends Trigger[EdgeBoxAction, Window] {

  override def onElement(element: EdgeBoxAction,
                         timestamp: Long,
                         window: Window,
                         ctx: Trigger.TriggerContext): TriggerResult =
    TriggerResult.FIRE_AND_PURGE
  override def onEventTime(time: Long, window: Window, ctx: Trigger.TriggerContext): TriggerResult =
    TriggerResult.CONTINUE

  //        override def onMerge(window: GlobalWindow, ctx: Trigger.OnMergeContext): Unit =
  //          super.onMerge(window, ctx)

  override def onProcessingTime(time: Long, window: Window, ctx: Trigger.TriggerContext): TriggerResult =
    TriggerResult.CONTINUE

  override def clear(window: Window, ctx: Trigger.TriggerContext): Unit = Unit

}
